package com.faithbj.simu;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class FirstServlet extends HttpServlet {

	private static final long serialVersionUID = 1L;
	
	
//	@Override  
//    protected void service(HttpServletRequest request, HttpServletResponse response)  
//            throws ServletException, IOException {  
//  
//        String name = request.getParameter("name");  
//  
//        if (name != null) {  
//            name = new String(name.getBytes("UTF-8"), "GBK");  
//        } else {  
//            name = "ddd！";  
//        }  
//  
//        response.setContentType("text/html;charset=GBK");  
//        PrintWriter printWriter = response.getWriter();  
//        printWriter.println("<HTML><HEAD><TITLE>myFirstServlet</TITLE>");  
//        printWriter.println("</HEAD><BODY>");  
//        printWriter.println("<h1><p>" + name + ":aaaa</h1>");  
//        printWriter.println("</BODY></HTML>");  
//	        printWriter.close();  
//	    }
	 
	
	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		RequestDispatcher rd = req.getRequestDispatcher("/confirm.jsp");
		String name = req.getParameter("PoaCode");
		if(name.equals("11111111111111111111111"))//有值
		{
			req.setAttribute("msg","11111111111111111111111");
		}
		else if(name.equals("00000000000000000000000"))//没有值
		{
			req.setAttribute("msg","00000000000000000000000");
		}
			
        
        rd.forward(req,resp);
	}





	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		 
		 doGet(req, resp);
	}  
	
	
	
	
	
}
